﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EnvDTE;
using ClassMetadataBrowser.Domain;

namespace ClassMetadataBrowser.Domain
{
	public delegate void MetadataLoaded(IMetadataProvider provider);

	public interface IMetadataProvider
	{
		string SlnFilePath { get; }

		/// <summary>
		/// This event will be fired when one the solution code files is changed
		/// and list of metedata should be rebound.
		/// </summary>
		event EventHandler Rebind;

		/// <summary>
		/// This event is fired if IsAvailable is false 
		/// and initialization finished.
		/// </summary>
		event EventHandler Initialized;

		/// <summary>
		/// Indicates weather metadata is loaded
		/// </summary>
		bool IsAvailable { get; }

		/// <summary>
		/// Indicates weather the provider is initialized or being initialized
		/// </summary>
		bool IsInitialized { get; }

		/// <summary>
		/// Collection of metadata objects
		/// </summary>
		IList<MetadataObjectBase> Metadata { get; }

		/// <summary>
		/// Reinitializes metadata for specified solution file
		/// </summary>
		/// <param name="currentCodeFilePath">current path to the solution file</param>
		/// <param name="newCodeFilePath">new path to the solution file</param>
		void ReInitializeMetadata(string currentCodeFilePath, string newCodeFilePath);

		/// <summary>
		/// Gets a list of applicable project items
		/// </summary>
		/// <param name="applicableExtensions">applicable extensions like .cs, .vb and etc...</param>
		/// <returns>a collection of ProjectFile objects</returns>
		IList<ProjectFile> GetApplicableProjectItems(string[] applicableExtensions);

		/// <summary>
		/// Executes selection commands. like selecting file or memeber.
		/// </summary>
		void ExecuteSelectionCommand();
	}
}
